import React, { useEffect, useRef,useState } from 'react';
import * as echarts from 'echarts';
import './info.less';
import { Button} from 'antd';
import {echartsResize} from '@/utils';
console.log(echarts);

export default function info() {
  const echartsHtml = useRef();
  const [num,setNum] = useState(300);
  useEffect(() => {
    let myChart = echarts.init(echartsHtml.current);
    myChart.setOption({
      xAxis: {
        type: 'category',
        data: ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun']
      },
      yAxis: {
        type: 'value'
      },
      series: [
        {
          data: [820, 932, 901, 934, 1290, 1330, num],
          type: 'line',
          smooth: true
        }
      ]
    })
    echartsResize(myChart);
    return ()=>{
      myChart.dispose();
    }
  }, [num])
  return <div>客户信息总览
    <div ref={echartsHtml} className='info'></div>
    <Button onClick={()=>{
      setNum(num+100);
    }}>点击</Button>
  </div>;
}
 